package com.example.weatherapp1.data.model


import com.google.gson.annotations.SerializedName

// 彩云天气API响应模型
data class WeatherResponse(
    @SerializedName("status") val status: String,
    @SerializedName("api_version") val apiVersion: String,
    @SerializedName("api_status") val apiStatus: String,
    @SerializedName("lang") val lang: String,
    @SerializedName("unit") val unit: String,
    @SerializedName("tzshift") val tzShift: Int,
    @SerializedName("timezone") val timezone: String,
    @SerializedName("server_time") val serverTime: Long,
    @SerializedName("location") val location: List<Double>,
    @SerializedName("result") val result: WeatherResult
)

data class WeatherResult(
    @SerializedName("realtime") val realtime: RealtimeWeather,
    @SerializedName("daily") val daily: DailyWeather,
    @SerializedName("primary") val primary: Int
)

data class RealtimeWeather(
    @SerializedName("status") val status: String,
    @SerializedName("temperature") val temperature: Double,
    @SerializedName("humidity") val humidity: Double,
    @SerializedName("cloudrate") val cloudRate: Double,
    @SerializedName("skycon") val skyCon: String,
    @SerializedName("visibility") val visibility: Double,
    @SerializedName("dswrf") val dswrf: Double,
    @SerializedName("wind") val wind: Wind,
    @SerializedName("pressure") val pressure: Double,
    @SerializedName("apparent_temperature") val apparentTemperature: Double,
    @SerializedName("precipitation") val precipitation: Precipitation,
    @SerializedName("air_quality") val airQuality: AirQuality,
    @SerializedName("life_index") val lifeIndex: LifeIndex,
    @SerializedName("observe_time") val observeTime: String
)

data class Wind(
    @SerializedName("speed") val speed: Double,
    @SerializedName("direction") val direction: Double
)

data class Precipitation(
    @SerializedName("local") val local: PrecipitationDetail,
    @SerializedName("nearest") val nearest: PrecipitationDetail
)

data class PrecipitationDetail(
    @SerializedName("status") val status: String,
    @SerializedName("distance") val distance: Double,
    @SerializedName("intensity") val intensity: Double
)

data class AirQuality(
    @SerializedName("pm25") val pm25: Double,
    @SerializedName("pm10") val pm10: Double,
    @SerializedName("o3") val o3: Double,
    @SerializedName("so2") val so2: Double,
    @SerializedName("no2") val no2: Double,
    @SerializedName("co") val co: Double,
    @SerializedName("aqi") val aqi: AQI,
    @SerializedName("description") val description: Description
)

data class AQI(
    @SerializedName("chn") val chn: Double,
    @SerializedName("usa") val usa: Double
)

data class Description(
    @SerializedName("chn") val chn: String,
    @SerializedName("usa") val usa: String
)

data class LifeIndex(
    @SerializedName("ultraviolet") val ultraviolet: LifeIndexItem,
    @SerializedName("comfort") val comfort: LifeIndexItem
)

data class LifeIndexItem(
    @SerializedName("index") val index: Double,
    @SerializedName("desc") val desc: String
)

data class DailyWeather(
    @SerializedName("status") val status: String,
    @SerializedName("temperature") val temperature: List<TemperatureItem>,
    @SerializedName("humidity") val humidity: List<HumidityItem>,
    @SerializedName("cloudrate") val cloudRate: List<CloudRateItem>,
    @SerializedName("skycon") val skyCon: List<SkyConItem>,
    @SerializedName("precipitation") val precipitation: List<PrecipitationItem>,
    @SerializedName("wind") val wind: List<WindItem>,
    @SerializedName("pressure") val pressure: List<PressureItem>,
    @SerializedName("visibility") val visibility: List<VisibilityItem>,
    @SerializedName("dswrf") val dswrf: List<DswrfItem>,
    @SerializedName("air_quality") val airQuality: DailyAirQuality,
    @SerializedName("life_index") val lifeIndex: DailyLifeIndex
)

// 每日数据项的通用结构
data class TemperatureItem(
    @SerializedName("date") val date: String,
    @SerializedName("max") val max: Double,
    @SerializedName("min") val min: Double
)

data class HumidityItem(
    @SerializedName("date") val date: String,
    @SerializedName("max") val max: Double,
    @SerializedName("min") val min: Double
)

data class CloudRateItem(
    @SerializedName("date") val date: String,
    @SerializedName("max") val max: Double,
    @SerializedName("min") val min: Double
)

data class SkyConItem(
    @SerializedName("date") val date: String,
    @SerializedName("value") val value: String
)

data class PrecipitationItem(
    @SerializedName("date") val date: String,
    @SerializedName("max") val max: Double,
    @SerializedName("min") val min: Double,
    @SerializedName("avg") val avg: Double
)

data class WindItem(
    @SerializedName("date") val date: String,
    @SerializedName("max") val max: WindDetail,
    @SerializedName("min") val min: WindDetail,
    @SerializedName("avg") val avg: WindDetail
)

data class WindDetail(
    @SerializedName("speed") val speed: Double,
    @SerializedName("direction") val direction: Double
)

data class PressureItem(
    @SerializedName("date") val date: String,
    @SerializedName("max") val max: Double,
    @SerializedName("min") val min: Double,
    @SerializedName("avg") val avg: Double
)

data class VisibilityItem(
    @SerializedName("date") val date: String,
    @SerializedName("max") val max: Double,
    @SerializedName("min") val min: Double,
    @SerializedName("avg") val avg: Double
)

data class DswrfItem(
    @SerializedName("date") val date: String,
    @SerializedName("max") val max: Double,
    @SerializedName("min") val min: Double,
    @SerializedName("avg") val avg: Double
)

data class DailyAirQuality(
    @SerializedName("pm25") val pm25: List<Pm25Item>,
    @SerializedName("pm10") val pm10: List<Pm10Item>,
    @SerializedName("o3") val o3: List<O3Item>,
    @SerializedName("so2") val so2: List<So2Item>,
    @SerializedName("no2") val no2: List<No2Item>,
    @SerializedName("co") val co: List<CoItem>,
    @SerializedName("aqi") val aqi: List<AqiItem>,
    @SerializedName("description") val description: List<DescriptionItem>
)

// 空气质量相关数据项
data class Pm25Item(
    @SerializedName("date") val date: String,
    @SerializedName("max") val max: Double,
    @SerializedName("min") val min: Double,
    @SerializedName("avg") val avg: Double
)

// 其他空气质量数据项结构类似，省略...

data class DailyLifeIndex(
    @SerializedName("ultraviolet") val ultraviolet: List<UltravioletItem>,
    @SerializedName("comfort") val comfort: List<ComfortItem>,
    @SerializedName("car_washing") val carWashing: List<CarWashingItem>,
    @SerializedName("dressing") val dressing: List<DressingItem>,
    @SerializedName("flu") val flu: List<FluItem>,
    @SerializedName("sport") val sport: List<SportItem>
)

// 生活指数相关数据项
data class UltravioletItem(
    @SerializedName("date") val date: String,
    @SerializedName("index") val index: Double,
    @SerializedName("desc") val desc: String
)

// 其他生活指数数据项结构类似，省略...
